package Inventory;


import javax.swing.JPanel;
import java.awt.Component;
import java.awt.GridBagLayout;
import java.awt.GridBagConstraints;

public class GBPane extends JPanel {
 
	private GridBagLayout GB;
	//private int nextX,nextY;
	
	//Constructors
	public GBPane(){
		setLayout(GB=new GridBagLayout());
	}
	
	//Methods
	public void addComponent(Component component, int gridx, int gridy,
		     int gridwidth, int gridheight, int weightx, int weighty, int fill,
		     int anchor) {
		     GridBagConstraints constraints = new GridBagConstraints();
		     constraints.gridx = gridx;
		     constraints.gridy = gridy;
		     constraints.gridwidth = gridwidth;
		     constraints.gridheight = gridheight;
		     constraints.weightx = weightx;
		     constraints.weighty = weighty; 
		     constraints.fill = fill;
		     constraints.anchor = anchor;
		     GB.setConstraints(component, constraints);
		     add(component);
		     //nextX=gridx+gridwidth;
		     //nextY=gridy+gridheight;
		 }
	public void paintAncestors(){
		Component C=this;
		
		while(C.getParent()!=null){
			C.repaint();
			C=C.getParent();
		}
	}
}
